Class Demo.Interface.spec Extends %REST.Spec [ ProcedureBlock ]
{

XData OpenAPI [ MimeType = application/json ]
{
{
  "swagger":"2.0",
  "info":{
    "description":"This is a dictionary table service API",
    "version":"1.0.0",
    "title":"Dictionary Table Service"
  },
  "basePath":"/demo",
  "schemes":[
    "http"
  ],
  "paths":{
    "/dictionary/match":{
      "post":{
        "summary":"Match a string to dictionary entries",
        "description":"Returns the top 5 matching dictionary entries with their scores",
        "operationId":"match",
        "parameters":[
          {
            "in":"body",
            "name":"body",
            "description":"String to match",
            "required":true,
            "schema":{
              "type":"object",
              "properties":{
                "inputString":{
                  "type":"string"
                }
              },
              "required":[
                "inputString"
              ]
            }
          }
        ],
        "responses":{
          "200":{
            "description":"Top 5 matching dictionary entries with scores",
            "schema":{
              "type":"array",
              "items":{
                "type":"object",
                "properties":{
                  "entry":{
                    "$ref":"#/definitions/DictionaryEntry"
                  },
                  "score":{
                    "type":"number"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/dictionary/upload":{
      "post":{
        "summary":"Upload CSV for base data",
        "description":"Uploads a CSV file to update the base data for matching",
        "operationId":"uploadcsv",
        "parameters":[
          {
            "in":"formData",
            "name":"file",
            "type":"file",
            "description":"CSV file to upload",
            "required":true
          }
        ],
        "responses":{
          "200":{
            "description":"CSV file uploaded successfully"
          },
          "400":{
            "description":"Invalid file format"
          }
        }
      }
    }
  },
  "definitions":{
    "DictionaryEntry":{
      "type":"object",
      "required":[
        "key",
        "value"
      ],
      "properties":{
        "id":{
          "type":"string",
          "readOnly":true
        },
        "key":{
          "type":"string"
        },
        "value":{
          "type":"string"
        }
      }
    }
  }
}
}

}
